package org.xy.dao;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.xy.bean.School;

@Component("schoolDAO")
public class SchoolDAO extends BasicDAO {

	@Autowired(required = false)
	@Qualifier("schoolA")
	private School school;

	public void insertDefault() {
		String sch_sql = "insert into school(id,name,status) values("
				+ this.school.getId() + ",'" + this.school.getName() + "','"
				+ this.school.getStatus() + "')";

		this.logger.info("Execute SQL:" + sch_sql);
		this.jdbcTemplate.execute(sch_sql);

	}

	public void insert(School school) {
		String sch_sql = "insert into school(id,name,status) values("
				+ school.getId() + ",'" + school.getName() + "','"
				+ school.getStatus() + "')";

		this.logger.info("Execute SQL:" + sch_sql);
		this.jdbcTemplate.execute(sch_sql);

	}
}
